@extends('layouts.main')

@section('title', '编辑付款方')

@section('content')
<h3>@yield('title')</h3>
<div class="btn-group" role="group">
  	<a href="{{ action('BusinessData\PayerController@index') }}" class="btn btn-primary">返回列表</a>
</div>

<form class="form-horizontal" method="post" action="{{ action('BusinessData\PayerController@update', $model) }}">
    @csrf
    @method('PUT')

    <div class="form-group">
		<label for="code" class="col-sm-2 control-label">付款方id</label>
		<div class="col-sm-3">
			<input class="form-control" id="code" name="code" placeholder="请输入付款方id" value="{{ old('code', $model->code) }}">
			@if($errors->first('code'))
			<p class="help-block error">{{ $errors->first('code') }}</p>
			@endif
		</div>
    </div>

    <div class="form-group">
		<label for="name" class="col-sm-2 control-label">付款方名称</label>
		<div class="col-sm-3">
			<input class="form-control" id="name" name="name" placeholder="请输入付款方名称" value="{{ old('name', $model->name) }}">
			@if($errors->first('name'))
			<p class="help-block error">{{ $errors->first('name') }}</p>
			@endif
		</div>
    </div>

	<div class="form-group">
		<label for="category_code" class="col-sm-2 control-label">客户分类</label>
		<div class="col-sm-3">
			<select class="form-control" id="category_code" name="category_code">
				@foreach($payer_category as $value)
				<option value="{{ $value->code }}" @if(old('category_code', $model->category_code) == $value->code) selected @endif>{{ $value->code.'---'.$value->name }}</option>
				@endforeach
			</select>
			@if($errors->first('category_code'))
			<p class="help-block error">{{ $errors->first('category_code') }}</p>
			@endif
		</div>
    </div>

    <div class="form-group">
		<div class="col-sm-offset-2 col-sm-10">
			<button type="submit" class="btn btn-primary">提交</button>
		</div>
    </div>

</form>

@endsection